public class J03Bianli {
    public static void main(String[] args) {
        //静态初始化简写，字面量初始化
        int[] arr = {1,4,6,7,9,100};
        for (int i = 0; i < 5; i++) {
            System.out.println(arr[i]);
        }
        //数组元素数
        System.out.println(arr.length);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}

//拷贝，copy
class CopyTest{
    public static void main(String[] args) {
        //浅拷贝，复制他的地址
        int[] arr1 = {1,4,7,9,66};//0x100
        int[] arr2 = arr1;
        //深拷贝，复制值，不复制地址
        int[] arr3 = new int[arr1.length];//0x900
        for (int i = 0; i <= arr1.length-1; i++) {
            //i=0,1,2
            arr3[i] = arr1[i];
        }
        System.out.println("arr1 = " + arr1);
        System.out.println("arr3 = " + arr3);
        for (int i = 0; i < arr3.length; i++) {
            System.out.println(arr3[i]);
        }

    }
}
